package com.slofzx.nuoda.evaluation.project.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;

/**
 * 油气藏类型枚举
 * @author sunhaifeng
 */
@EnumConfig(
    id = "oil-pool-type-new",
    name = "油气藏类型"
)
public enum OilPoolTypeEnum implements Type {
    CONVENTIONAL_OIL_AND_GAS("conventional_oil_and_gas", "陆上常规",1),
    SPECIAL_OIL_AND_GAS("special_oil_and_gas", "陆上特殊",2),
    SHALE_OIL("shale_oil", "页岩油",3),
    TIGHT_OIL("tight_oil", "致密油",4),
    OIL_SHALE_AND_OIL_SAND_MINES("oil_shale_and_oil_sand_mines", "油页岩及油砂矿",5),
    ;

    /**
     * 标识
     */
    private String id;
    /**
     * 名称
     */
    private String name;
    /**
     * 排序值
     */
    private double sort;

    OilPoolTypeEnum(String id, String name, double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    /**
     * 根据标识获取枚举值
     * @param id
     * @return
     */
    public static OilPoolTypeEnum getEnum(String id) {
        for(OilPoolTypeEnum item:values()) {
            if (item.getId().equals(id)) {
                return item;
            }
        }
        return null;
    }

    public static OilPoolTypeEnum getEnumByName(String name) {
        for(OilPoolTypeEnum item:values()) {
            if (item.getName().equals(name)) {
                return item;
            }
        }
        return null;
    }

}
